@include('admin.public.head')
@include('admin.public.pop')

<style type="text/css">
    .inner_btn {
        background: #19a97b;
        color: white;
        padding: 5px 8px;
        border-radius: 2px;
    }
</style>

<div class="ibox-title">
    <h5>商品管理</h5>
</div>

<div class="ibox-content">
    @if(permission('/goods_add', $user['right_list'], $user['get_routes']))
    <div class="row">
        <div class="col-sm-12 clear">
            <div class="" style="margin: 15px 10px">
                <a href="/goods_add" class="btn btn-w-m btn-primary">新增</a>
            </div>
        </div>
    </div>
    @endif

    <div class="row">
        <div class="col-sm-12 pull-right m-b-xs">
            <form action="">
                <div class="col-sm-1  m-b-xs text-center pull-right">
                    <button type="submit" class="btn btn-sm btn-primary">搜索</button> </span>
                </div>

                <div class="col-sm-2 text-center pull-right">
                    <input type="text" name="sear_value" value="{{$sear_value}}" placeholder="商品名稱" class="input form-control">
                </div>

                <div class="col-sm-1 text-center pull-right">
                    <select class="form-control" name="is_opend" >
                        <option value="">商品狀態</option>
                        <option value="1" @if($is_opend == 1) selected="selected" @endif>上架</option>
                        <option value="2" @if($is_opend == 2) selected="selected" @endif>下架</option>
                    </select>
                </div>

            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>商品名稱</th>
                <th>库存</th>
                <th>商品價格</th>
                <th>商品圖片</th>
                <th>商品狀態</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
        @foreach ($result as $v)
            <tr>
                <td>{{$v->goods_name}}</td>
                <td>{{$v->stock}}</td>
                <td>{{$v->goods_price}}</td>
                <td><img src="{{$v->goods_img}}" width="300" height="150"></td>
                <td>
                    @if($v->is_opend == 1)上架@endif
                    @if($v->is_opend == 2)下架@endif
                </td>
                <td>
                    @if(permission('/goods_edit', $user['right_list'], $user['get_routes']))
                    <div class="btn-group">
                        <a  class="btn btn-primary btn-sm dropdown-toggle" href="/goods_edit/{{$v->id}}">編輯
                        </a>&nbsp;&nbsp;
                    </div>
                    @endif
                    @if(permission('/goods_del', $user['right_list'], $user['get_routes']))
                    <div class="btn-group">
                        <a  class="btn btn-primary btn-sm dropdown-toggle" href="javascript:void(0)" onclick="del($(this))" url="/goods_del/{{$v->id}}">刪除
                        </a>&nbsp;&nbsp;
                    </div>
                    @endif
                </td>
            </tr>
        @endforeach
        </tbody>
        {{ $result->appends(Request::except('page'))->links() }}
    </table>
    {{ $result->appends(Request::except('page'))->links() }}
</div>

